from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Chrome()
driver.get('https://www.baidu.com')

# id
kw = driver.find_element(By.ID, 'kw')
print(kw.id)

# size 宽高
print(kw.size)

# rect 宽高和坐标
print(kw.rect)

# tag_name 标签
print(kw.tag_name)

# text 文本内容
print(kw.text)
news = driver.find_element(By.LINK_TEXT, '新闻')
print(news.text)

time.sleep(2)
driver.quit()